{% extends "layout" %}

{% block local %}<div id="local">
	{% if kit.has_tests %}
	{% if kit.tests_report.getstatus %}<div class="tests_ok">
	<h3 class="tests_pass">Unit tests</h3>
	<p>{{ kit.tests_report.getpasscount }} successful tests. <!--<a href="kit/{{ id }}/tests">voir le détail</a>.--></p>
	</div>
	{% else %}<div class="tests_ko">
	<h3 class="tests_fails">Unit tests</h3>
	<p>{{ kit.tests_report.getfailcount }} tests failed. <a href="kit/{{ kit.id }}/tests">see details</a>.</p>
	</div>{% endif %}{% endif %}
</div>{% endblock %}

{% block main %}
	<h2>Kit {{ kit.id }} {{ kit.version }} </h2>

	{% if kit.error %}<p>This kit seems to be badly built.</p>
	<p>Error message was <cite>{{ kit.error.getmessage }}</cite></p>{% endif %}

	<p>{{ cfg.kit.desc }}</p>

	{% if kit.link %}<p><a href="{{ kit.link }}">web site</a></p>{% endif %}

	{% if kit.phpversion %}
		<p>PHP versions supported : {{ kit.phpversion }}</p>
	{% endif %}

	{% if kit.dependencies %}<div class="dependencies">
	<h3>Required Kits</h3>
	<ul class="req-kits">{% for req in kit.dependencies %}
		<li><a href="kit/{{ req }}">{{ req}}</a></li>{% endfor %}
	</ul>
	</div>{% endif %}

	{% if kit.subkits %}
	<table class="kits" summary="subkits">
		<caption>Subkits for <a href="kit/{{ kit.id }}">{{ kit.id }}</a></caption>
		<tr class="headers">
			<th class="diagnostic"></th>
			<th>Id</th>
			<th>Description</th>
			<th class="tests"><span>Has unit tests ?</span></th>
			<th class="doc"><span>Has documentation ?</span></th>
			<th class="subkits"><span>Has subkits ?</span></th>
		</tr>{% for sub in kit.subkits %}
		<tr class="{% cycle odd,even %}">
			{% if sub.error %}
			<td class="icon kit_ko"><span>This kit can't work</span></td>
			{% else %}
			<td class="icon kit_ok"><span>This kit seems functional</span></td>
			{% endif %}

			<td><a href="kit/{{ sub.id }}">{{ forloop.key }}</a></td>
			<td>{{ sub.desc }}</td>

			{% if sub.has_tests %}
			<td class="icon has_tests"><span>yes</span></td>
			{% else %}
			<td class="icon has_no_tests"><span>no</span></td>
			{% endif %}

			<td></td>

			{% if sub.subkits %}
			<td class="has_subkits"><span>{{ sub.subkits|count }}</span></td>
			{% else %}
			<td class="has_no_subkits"><span>0</span></td>
			{% endif %}

			{% if sub.link %}
			<td><a href="{{ sub.link }}" class="link">web</a></td>
			{% else %}
			<td></td>
			{% endif %}

		</tr>{% endfor %}
	</table>{% endif %}

	{% if cfg.load_files %}<div class="files">
	<h3>Included library files</h3>
	<dl>{% for file in cfg.load_files %}
		<dt>{{ file }}</dt>{% endfor %}
	</dl>
	</div>{% endif %}

	{% comment %}<p>view kit</p>
	<pre>{{ kit|dump }}</pre>{% endcomment %}
{% endblock %}
